//
//  YYJLCurriculumCell.m
//  YuanyangJinlou
//
//  Created by mac004 on 2017/1/10.
//  Copyright © 2017年 suli19910309@qq.com. All rights reserved.
//

#import "YYJLCurriculum1Cell.h"
@interface YYJLCurriculum1Cell(){
    UIImageView * showPic;//展示图片
    UIButton    * playBtn;//播放按钮
    UILabel     * titleLB;//名称
    UILabel     * conditionLb;//条件
    UILabel     * styleLb;//类型
    UILabel     * timeLb;//时长
    UILabel     * numLb;//观看次数
    UIImageView * liulan;
    
    
}
@end
@implementation YYJLCurriculum1Cell
-(instancetype)initWithFrame:(CGRect)frame{
    if (self=[super initWithFrame:frame]) {
        [self creatUI];
    }
    return self;
}
-(void)creatUI{
    showPic=[[UIImageView alloc]initWithFrame:CGRectMake(0, 0, 171*PER_WIDTH, 110*PER_HEIGHT)];
    showPic.image=[UIImage imageNamed:@"img_kecheng1"];
    [self.contentView addSubview:showPic];
    UIImage * playImg=[UIImage imageNamed:@"ico_bofang"];//31*31
    playBtn=[MyControl createButtonWithFrame:CGRectMake(showPic.width/2-playImg.size.width/2*PER_WIDTH, showPic.height/2-playImg.size.height/2*PER_WIDTH, playImg.size.width*PER_WIDTH, playImg.size.width*PER_WIDTH) ImageName:@"ico_bofang" Target:self Action:@selector(play) Title:@""];
    [showPic addSubview:playBtn];
    
    titleLB=[MyControl createLabelWithFrame:CGRectMake(5*PER_WIDTH, showPic.bottom+10*PER_HEIGHT, showPic.width-10*PER_WIDTH, 13*PER_HEIGHT) Font:13 Text:@"你怎么辨别碧玺的真假吗" Color:BLACK_COLOR];
    [self.contentView addSubview:titleLB];
    
    conditionLb=[MyControl createLabelWithFrame:CGRectMake(5*PER_WIDTH, titleLB.bottom+15*PER_HEIGHT, titleLB.width, 13*PER_HEIGHT) Font:13 Text:@"所需积分: 免费" Color:FEELT_COLOR];
    [self.contentView addSubview:conditionLb];
    
    styleLb=[MyControl createLabelWithFrame:CGRectMake(titleLB.left, conditionLb.bottom+10*PER_HEIGHT, titleLB.width, 13*PER_HEIGHT) Font:13 Text:@"类型: 珠宝知识大全" Color:FEELT_COLOR];
    [self.contentView addSubview:styleLb];
    
    timeLb=[MyControl createLabelWithFrame:CGRectMake(titleLB.left, styleLb.bottom+10*PER_HEIGHT, titleLB.width/2+10*PER_WIDTH, 13*PER_HEIGHT) Font:13 Text:@"时长: 1:20" Color:FEELT_COLOR];
    [self.contentView addSubview:timeLb];
    
    numLb=[MyControl createLabelWithFrame:CGRectMake(showPic.right-10*PER_WIDTH-30, timeLb.top, 30, 13*PER_HEIGHT) Font:13 Text:@"64" Color:FEELT_COLOR];
    numLb.textAlignment=NSTextAlignmentRight;
    [self.contentView addSubview:numLb];
    
    UIImage * img= [UIImage imageNamed:@"ico_liulan"];//16*9
    liulan=[[UIImageView alloc]initWithFrame:CGRectMake(numLb.left-5*PER_WIDTH-img.size.width*PER_WIDTH, timeLb.top+2*PER_HEIGHT, img.size.width*PER_WIDTH, img.size.height*PER_HEIGHT)];
    liulan.image=img;
    [self.contentView addSubview:liulan];
    
}
-(void)setIsVieo:(BOOL)isVieo{
    _isVieo=isVieo;
    if (_isVieo) {
        playBtn.hidden=NO;
    }else{
        playBtn.hidden=YES;
        timeLb.text=@"47人看过";
        numLb.hidden=YES;
        liulan.hidden=YES;
    }
}
-(void)play{
    if (_delegate &&[_delegate respondsToSelector:@selector(playVideo:)]) {
        [_delegate playVideo:1];
    }
}
@end
